import hashlib

def verify_update(new_params, expected_hash):
    """
    验证更新
    :param new_params: 新的模型参数
    :param expected_hash: 预期的哈希值
    :return: 是否验证通过
    """
    new_params_hash = hashlib.sha256(new_params).hexdigest()
    return new_params_hash == expected_hash

# 示例
new_params = b"new_model_weights"
expected_hash = hashlib.sha256(new_params).hexdigest()
is_verified = verify_update(new_params, expected_hash)
print(f"Update verified: {is_verified}")